#Boa:Frame:editarCli_Frame

import wx
from ControleCliente import *
from Frame_Clientes import *

def create(parent):
    return editarCli_Frame(parent)

[wxID_EDITARCLI_FRAME, wxID_EDITARCLI_FRAMECANCELARALTERACAO, 
 wxID_EDITARCLI_FRAMECONFALTERARCLI, wxID_EDITARCLI_FRAMESTATICBOX1, 
 wxID_EDITARCLI_FRAMESTATICTEXT1, wxID_EDITARCLI_FRAMESTATICTEXT2, 
 wxID_EDITARCLI_FRAMESTATICTEXT3, wxID_EDITARCLI_FRAMESTATICTEXT4, 
 wxID_EDITARCLI_FRAMESTATICTEXT5, wxID_EDITARCLI_FRAMESTATICTEXT6, 
 wxID_EDITARCLI_FRAMESTATICTEXT7, wxID_EDITARCLI_FRAMESTATICTEXT8, 
 wxID_EDITARCLI_FRAMETEXTCTRL1, wxID_EDITARCLI_FRAMETEXTCTRL2, 
 wxID_EDITARCLI_FRAMETEXTCTRL3, wxID_EDITARCLI_FRAMETEXTCTRL4, 
 wxID_EDITARCLI_FRAMETEXTCTRL5, wxID_EDITARCLI_FRAMETEXTCTRL6, 
 wxID_EDITARCLI_FRAMETEXTCTRL7, 
] = [wx.NewId() for _init_ctrls in range(19)]

class editarCli_Frame(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_EDITARCLI_FRAME,
              name=u'editarCli_Frame', parent=prnt, pos=wx.Point(472, 128),
              size=wx.Size(663, 411), style=wx.DEFAULT_FRAME_STYLE,
              title=u'editarCli_Frame')
        self.SetClientSize(wx.Size(647, 373))
        self.SetBackgroundColour(wx.Colour(255, 255, 255))

        self.staticBox1 = wx.StaticBox(id=wxID_EDITARCLI_FRAMESTATICBOX1,
              label=u'Editar Cliente', name='staticBox1', parent=self,
              pos=wx.Point(0, 0), size=wx.Size(647, 373), style=0)

        self.staticText1 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT1,
              label=u'Cliente ID', name='staticText1', parent=self,
              pos=wx.Point(16, 40), size=wx.Size(70, 19), style=0)
        self.staticText1.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl1 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL1,
              name='textCtrl1', parent=self, pos=wx.Point(96, 40),
              size=wx.Size(100, 21), style=0, value=u'')
        self.textCtrl1.Enable(False)
        self.textCtrl1.SetEditable(False)

        self.staticText2 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT2,
              label=u'Nome Completo', name='staticText2', parent=self,
              pos=wx.Point(16, 80), size=wx.Size(108, 19), style=0)
        self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl2 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL2,
              name='textCtrl2', parent=self, pos=wx.Point(136, 80),
              size=wx.Size(392, 21), style=0, value=u'')

        self.staticText3 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT3,
              label=u'Telefone', name='staticText3', parent=self,
              pos=wx.Point(16, 120), size=wx.Size(59, 19), style=0)
        self.staticText3.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl3 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL3,
              name='textCtrl3', parent=self, pos=wx.Point(88, 120),
              size=wx.Size(128, 21), style=0, value=u'')

        self.staticText8 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT8,
              label=u'Ex: (11) 1111-1111', name='staticText8', parent=self,
              pos=wx.Point(232, 120), size=wx.Size(95, 16), style=0)

        self.staticText4 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT4,
              label=u'E-Mail', name='staticText4', parent=self, pos=wx.Point(16,
              160), size=wx.Size(47, 19), style=0)
        self.staticText4.Enable(True)
        self.staticText4.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl4 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL4,
              name='textCtrl4', parent=self, pos=wx.Point(80, 160),
              size=wx.Size(200, 21), style=0, value=u'')

        self.staticText5 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT5,
              label=u'Data de Nascimento', name='staticText5', parent=self,
              pos=wx.Point(16, 200), size=wx.Size(136, 19), style=0)
        self.staticText5.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl5 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL5,
              name='textCtrl5', parent=self, pos=wx.Point(168, 200),
              size=wx.Size(24, 21), style=0, value=u'')
        self.textCtrl5.SetMaxLength(2)
        self.textCtrl5.SetToolTipString(u'textCtrl5')

        self.staticText6 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT6,
              label=u'/', name='staticText6', parent=self, pos=wx.Point(200,
              200), size=wx.Size(7, 24), style=0)
        self.staticText6.SetFont(wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl6 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL6,
              name='textCtrl6', parent=self, pos=wx.Point(216, 200),
              size=wx.Size(24, 21), style=0, value=u'')
        self.textCtrl6.SetMaxLength(2)

        self.staticText7 = wx.StaticText(id=wxID_EDITARCLI_FRAMESTATICTEXT7,
              label=u'/', name='staticText7', parent=self, pos=wx.Point(256,
              200), size=wx.Size(7, 24), style=0)
        self.staticText7.SetFont(wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Times New Roman'))

        self.textCtrl7 = wx.TextCtrl(id=wxID_EDITARCLI_FRAMETEXTCTRL7,
              name='textCtrl7', parent=self, pos=wx.Point(272, 200),
              size=wx.Size(40, 21), style=0, value=u'')
        self.textCtrl7.SetMaxLength(4)

        self.CancelarAlteracao = wx.Button(id=wxID_EDITARCLI_FRAMECANCELARALTERACAO,
              label=u'Cancelar', name=u'CancelarAlteracao', parent=self,
              pos=wx.Point(176, 264), size=wx.Size(96, 56), style=0)
        self.CancelarAlteracao.Bind(wx.EVT_BUTTON,
              self.OnCancelarAlteraracaoCliButton,
              id=wxID_EDITARCLI_FRAMECANCELARALTERACAO)

        self.confAlterarCli = wx.Button(id=wxID_EDITARCLI_FRAMECONFALTERARCLI,
              label=u'Salvar Altera\xe7\xe3o', name=u'confAlterarCli',
              parent=self, pos=wx.Point(16, 264), size=wx.Size(128, 56),
              style=0)
        self.confAlterarCli.Bind(wx.EVT_BUTTON, self.OnConfAlterararCliButton,
              id=wxID_EDITARCLI_FRAMECONFALTERARCLI)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnCancelarAlteraracaoCliButton(self, event):
        import Frame_Clientes
        tela = Frame_Clientes.create(None)
        tela.Show()
        self.Close()

    def OnConfAlterararCliButton(self, event):
        id = self.textCtrl1.GetValue()
        nome = self.textCtrl2.GetValue()
        telefone = self.textCtrl3.GetValue()
        email = self.textCtrl4.GetValue()
        dia = int(self.textCtrl5.GetValue())
        mes = int(self.textCtrl6.GetValue())
        ano = int(self.textCtrl7.GetValue())
        a = ControleCliente()   
        a.alterarClienteTodo(id, nome, telefone,email, ano,mes,dia)
        
        m = 'Altera\xe7\xf5es Salvas Com Sucesso'
        c = 'Editar Informa\xe7\xf5es do Cliente'
        
        wx.MessageBox(m,c,wx.OK)
        
        
        import Frame_Clientes
        Frame_Clientes.create(None).Show()
        self.Close()
        
